/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package drag;

import javafx.event.EventHandler;
import javafx.scene.image.ImageView;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;

/* Classe engenheira que realiza os projetos para cosntução de imoveis no campo
 * @author Adriano
 */
public class Engenheiro {

    private ImageView source;
    private DragDone dragDone;
    private DragDetected dragDetected;
    private String type;

    public Engenheiro(ImageView source, String type) {
        this.source = source;
        this.dragDetected = new DragDetected();
        this.dragDone = new DragDone();
        this.type = type;
    }
    /**
     * Classe que implementa os metodos do Mouseevent dos imoveis
     */
    public class DragDetected implements EventHandler<MouseEvent> {
        @Override
        public void handle(MouseEvent event) {
            Dragboard db = source.startDragAndDrop(TransferMode.ANY);

            ClipboardContent content = new ClipboardContent();
            content.putImage(source.getImage());//
            content.putString(type);
            db.setContent(content);
            event.consume();
        }
    }

    /**
     * Classe que implementa os metodos do Dragevent e é chamado ao térmio da operação
     */
    public class DragDone implements EventHandler<DragEvent> {

        @Override
        public void handle(DragEvent event) {
            if (event.getTransferMode() == TransferMode.MOVE) {
                
            }
            event.consume();
        }
    }

    public DragDone getDragDone() {
        return dragDone;
    }

    public DragDetected getDragDetected() {
        return dragDetected;
    }
}
